package com.lx.onbording.vshe.testassignment.core.dao;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.lx.onbording.vshe.testassignment.core.domain.Order;
import com.lx.onbording.vshe.testassignment.core.domain.Product;

@Repository
public class ProductDAO extends GenericDAOImpl<Product, Long> {
	public List<Product> findAll(int start, int fetch) {
		Query query = em.createQuery(" from Product p");
		if (start != 0 && fetch != 0) {
			query.setFirstResult(start);
			query.setMaxResults(fetch);
		}
		return (List<Product>) query.getResultList();
	}
}
